
package fileby.ctrl.tabs;

import fileby.model.ISourceHandler;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author Jacob
 */
public class TabPanelListener implements ChangeListener {
    
    private ISourceHandler sourceHandler;
    
    public TabPanelListener(ISourceHandler sourceHandler) {
        this.sourceHandler = sourceHandler;
    }
    
    public void stateChanged(ChangeEvent e) {
        sourceHandler.switchCurrentSource(((JTabbedPane)e.getSource()).getSelectedIndex());
    }

}
